package com.chenchen.code.guava.eventbus.monitor;

import com.google.common.eventbus.EventBus;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
* @Description: 
* @author chenchen
* @date 2019/5/13 15:25 
*/
public class MonitorClient
{
    public static void main(String[] args) throws Exception
    {
        final EventBus eventBus = new EventBus();
        eventBus.register(new FileChangeListener());

        TargetMonitor monitor = new DirectoryTargetMonitor(eventBus, "D:\\guavatest");
       /* ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
        executorService.schedule(() ->
        {
            try
            {
                monitor.stopMonitor();
            } catch (Exception e)
            {
                e.printStackTrace();
            }
        }, 2, TimeUnit.SECONDS);
        executorService.shutdown();*/
        monitor.startMonitor();

    }
}

